package j04map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class J5bianli {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("name","luxun");
        map.put("nick","luxun");
        map.put("age","中年");
        map.put("sex","boy");

        Set<String> keyArr = map.keySet();
        for (String key : keyArr) {
            System.out.println("key = " + key+",value="+map.get(key));
        }

        System.out.println("====");
        Set<Map.Entry<String,String>> entryArr = map.entrySet();
        for (Map.Entry<String, String> entry : entryArr) {
            System.out.println(entry.getKey()+"-"+entry.getValue());
        }
    }
}
